<template>
	<view class='login-container'>
		<view class='title'>
			<text class='tt'>{{news.title}}</text>
			<text class='time'>{{time}}</text>
		</view>
		<scroll-view scroll-y="true" :style="scrollstyle">
		<view class='content'>
			<rich-text :nodes="news.content">
				
			</rich-text>
		</view>
		</scroll-view>
		<view class="footer">
			<text style='color:#586C94;font-size:14px;font-family:STXingkai'>CQJTU\n</text>
			<text style="font-size:12px;">Copyright © 2018-2019 Leather-Sofa</text>
		</view>
	</view>
</template>

<script>
	import utils from "../../static/js/utils.js"
	const device = uni.getSystemInfoSync();
	const height = device.windowHeight - uni.upx2px(320);
	export default {
		computed: {
			scrollstyle() {
				return "width:92%;margin-top:2px;height:" + height + "px;";
			}
		},
		data() {
			return {
				news:{
					
				},
				time:''
			}
		},
		methods: {
			
		},
		onLoad(option) {
			let url = option.url;
			this.time = option.time;
			let news = uni.getStorageSync(url)||[];
			if(news.length==0) {
				let that = this;
				utils.post("news/get",{
					newsId:url
				},function(data){
					that.news = data;
					uni.setStorageSync(url,data);
				},function(errMsg){
					utils.errorToast(errmsg);
					uni.navigateBack({
						delta: 1
					});
				});
			}else{
				this.news = news;
			}
			
		}
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
	}

	.login-container {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.title {
		width: 92%;
		height: 180rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		box-shadow: inset 0px -1px 1px -1px #c8c7cc;
	}

	.title .tt {
		font-size: 32rpx;
		font-weight: 600;
		
	}

	.title .time {
		font-size: 26rpx;
		color: #666;
	}

	.content {
		width: 100%;
		margin-top: 30upx;
	}

	.footer {
		width: 80%;
		position: fixed;
		bottom:40upx ;
		background-color: #ffffff;
		z-index: 999;
		text-align: center;
		height: 100rpx;
	}
</style>
